Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

durable task scheduler auth extension support #362

Merged
merged 58 commits into from
Jan 16, 2025
Merged

durable task scheduler auth extension support #362

merged 58 commits into from
Jan 16, 2025

Conversation

YunchuWang
Copy link
Member

@YunchuWang YunchuWang commented Jan 9, 2025

This pull request introduces several significant changes, primarily focusing on the setup of new projects and the integration of Azure Managed extensions for the Durable Task Framework client. The most important changes include the addition of new projects to the solution, updates to the build configuration, and the implementation of new client extensions and options for Azure Managed services.

New Projects and Build Configuration:

  • Added new projects Worker.AzureManaged, Client.AzureManaged, Shared.AzureManaged.Tests, Client.AzureManaged.Tests, and Worker.AzureManaged.Tests to the solution file Microsoft.DurableTask.sln.
  • Updated the build configuration in Microsoft.DurableTask.sln to include the newly added projects. [1] [2]
  • Set up .NET 6.0 in the GitHub Actions workflow file .github/workflows/validate-build.yml.

Azure Managed Client Implementation:

  • Created the Client.AzureManaged.csproj project file with necessary package references and project dependencies.
  • Implemented DurableTaskSchedulerClientExtensions to provide extension methods for configuring Durable Task clients to use the Azure Durable Task Scheduler service.
  • Defined DurableTaskSchedulerClientOptions to configure the Durable Task Scheduler, including methods for creating gRPC channels and handling connection strings.
  • Added AccessTokenCache to manage and refresh Azure access tokens.
  • Implemented DurableTaskSchedulerConnectionString to parse and handle connection strings for the Durable Task Scheduler service.

Copy link
Member

@cgillum cgillum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking great! I added some comments.

src/Extensions/Azure/DurableTaskSchedulerOptions.cs Outdated Show resolved Hide resolved
src/Extensions/Azure/DurableTaskSchedulerExtensions.cs Outdated Show resolved Hide resolved
src/Extensions/Azure/DurableTaskSchedulerExtensions.cs Outdated Show resolved Hide resolved
@cgillum
Copy link
Member

cgillum commented Jan 9, 2025

@jviau would you mind taking a look at this as well?

The main feedback I'm interested in from you is the package name/organization. The idea behind this PR is to introduce a mechanism for configuring the gRPC channels to work with the Durable Task Scheduler (DTS). This includes setting up the appropriate auth and some other service-specific headers (like the task hub name). I figured this might be the right time to introduce an "Extensions" concept and make "Azure" the extension consumers should use for talking to DTS. There could be others in the future. WDYT?

@YunchuWang YunchuWang requested a review from cgillum January 9, 2025 10:05
src/Extensions/Azure/DurableTaskSchedulerExtensions.cs Outdated Show resolved Hide resolved
src/Extensions/Azure/DurableTaskSchedulerExtensions.cs Outdated Show resolved Hide resolved
src/Extensions/Azure/DurableTaskSchedulerExtensions.cs Outdated Show resolved Hide resolved
src/Extensions/Azure/DurableTaskSchedulerExtensions.cs Outdated Show resolved Hide resolved
src/Extensions/Azure/DurableTaskSchedulerExtensions.cs Outdated Show resolved Hide resolved
Microsoft.DurableTask.sln Outdated Show resolved Hide resolved
src/Extensions/Azure/Azure.csproj Outdated Show resolved Hide resolved
src/Extensions/Azure/DurableTaskSchedulerOptions.cs Outdated Show resolved Hide resolved
src/Extensions/Azure/DurableTaskSchedulerExtensions.cs Outdated Show resolved Hide resolved
src/Extensions/Azure/DurableTaskSchedulerOptions.cs Outdated Show resolved Hide resolved
@jviau
Copy link
Member

jviau commented Jan 10, 2025

I figured this might be the right time to introduce an "Extensions" concept and make "Azure" the extension consumers should use for talking to DTS. There could be others in the future. WDYT?

I wonder if we want a name other that Extensions for backends? I am worried this may get confused with a backend vs helpers for Azure / a specific Azure service. Say we wanted to port an AzureStorage backend hook to durable - where would that go? Or if we wanted to introduce helpers (not backends) for interacting with Azure services (Compute, Storage, CosmosDB, etc). Where would those go?

There is the Worker and Client naming for this already. Worker's are backends, Clients are for interacting with a backend. Would separate Worker.AzureManaged and Client.AzureManaged (or just "Azure") be better?

This also brings up the point of keeping a separate Worker and Client package. While it is more setup work on our end, the benefit is customers can bring in just the clients for their API projects and not need the entire worker.

@YunchuWang
Copy link
Member Author

YunchuWang commented Jan 12, 2025

split into separate packages and split tests, also add @cgillum 's sample to here using split packages and tested working
{9C0F3874-3AD9-459E-AF9F-4A643215CF8A}, thanks, can you review again?

samples/AspNetWebApp/AspNetWebApp.csproj Outdated Show resolved Hide resolved
samples/AspNetWebApp/Program.cs Outdated Show resolved Hide resolved
src/Shared/AzureManaged/DurableTaskSchedulerOptions.cs Outdated Show resolved Hide resolved
src/Shared/AzureManaged/DurableTaskSchedulerOptions.cs Outdated Show resolved Hide resolved
samples/AspNetWebApp/Utils.cs Outdated Show resolved Hide resolved
samples/AspNetWebApp/appsettings.Production.json Outdated Show resolved Hide resolved
src/Shared/AzureManaged/Shared.AzureManaged.csproj Outdated Show resolved Hide resolved
src/Shared/AzureManaged/Shared.AzureManaged.csproj Outdated Show resolved Hide resolved
@YunchuWang YunchuWang requested a review from cgillum January 13, 2025 22:44
@YunchuWang YunchuWang requested a review from jviau January 14, 2025 05:02
@YunchuWang
Copy link
Member Author

YunchuWang commented Jan 14, 2025

thanks, updated to two packages. can i get another review @jviau @cgillum

Copy link
Member

@cgillum cgillum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few minor things.

@YunchuWang YunchuWang requested a review from cgillum January 15, 2025 16:53
.editorconfig Outdated Show resolved Hide resolved

<ItemGroup>
<PackageReference Include="Azure.Identity" Version="1.13.1" />
<PackageReference Include="Microsoft.Extensions.Options.DataAnnotations" Version="8.0.0" />
Copy link
Member

@jviau jviau Jan 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are targeting net6 but using a v8.x package. While this is technically 'valid', it may be confusing to users. Are we able to use a 6.x package here?

Side note: targeting net8 and using v8.x packages would be another discussion / work item. Don't want to get that tangled into this PR.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{791DA31B-A16A-4053-8E00-379D46984313} v6 of this package does not target dotnet 6, and v7 does not have
{16E38BDC-D45C-4567-ADB7-9851B06452D0} validateonstart. v8 is min version targeting dotnet 6 and has validateonstart api

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need ValidateOnStart? This will effectively be validated on start, as validation will occur on first import of it, which will be done at start due to this being eventually imported by a IHostedService (the DurableTaskWorker)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point, updated ver and removed validateonstart

src/Worker/AzureManaged/Worker.AzureManaged.csproj Outdated Show resolved Hide resolved
Copy link
Member

@cgillum cgillum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All my main concerns are resolved. Thanks @YunchuWang! I agree with Jacob's recent round of feedback too, so let's address those (I'll leave it up to you to decide on whether to take on some of the code de-duplication, I don't have a strong opinion on this) and then I think we're good to merge this.

@YunchuWang YunchuWang requested review from jviau and cgillum January 15, 2025 21:33
Copy link
Member

@cgillum cgillum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we be using 6.x version of the nuget package?

src/Client/AzureManaged/Client.AzureManaged.csproj Outdated Show resolved Hide resolved
src/Worker/AzureManaged/Worker.AzureManaged.csproj Outdated Show resolved Hide resolved
@cgillum cgillum merged commit 9006eec into main Jan 16, 2025
4 checks passed
@cgillum cgillum deleted the wangbill/auth branch January 16, 2025 01:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants